﻿using BCCommon.Extensions;
using System.Linq;

namespace BCCommon
{
    public class FixedCityCode
    {
        public static string GetFixedCityCode(string zoneCode)
        {
            string provincePrefix = zoneCode.Substring(0, 2);
            string[] comuntitySpecifical = new string[] { "429005", "429004", "429006", "419001" };
            // 直辖市编码修复。
            if (provincePrefix.In("11", "12", "31", "50"))
            {
                return zoneCode.Substring(0, 2) + "0100";
            }
            else if (comuntitySpecifical.Any(p => p.Equals(zoneCode)))
            {
                return zoneCode;
            }
            return zoneCode.Substring(0, 4) + "00";
        }
    }
}
